package za.ac.cput.garethc.designpatterns.behavioural.mediator;

/**
 *
 * @author Gareth
 */
public class Mediator
{

    private Buyer swedishBuyer;
    private Buyer frenchBuyer;
    private AmericanSeller americanSeller;
    private DollarConverter dollarConverter;

    public Mediator()
    {
    }

    public void registerSwedishBuyer(SwedishBuyer swedishBuyer)
    {
        this.swedishBuyer = swedishBuyer;
    }

    public void registerFrenchBuyer(FrenchBuyer frenchBuyer)
    {
        this.frenchBuyer = frenchBuyer;
    }

    public void registerAmericanSeller(AmericanSeller americanSeller)
    {
        this.americanSeller = americanSeller;
    }

    public void registerDollarConverter(DollarConverter dollarConverter)
    {
        this.dollarConverter = dollarConverter;
    }

    public boolean placeBid(float bid, String unitOfCurrency)
    {
        float dollarAmount = dollarConverter.convertCurrencyToDollars(bid, unitOfCurrency);
        return americanSeller.isBidAccepted(dollarAmount);
    }
}
